package com.app.controller.miniprogram;

import com.alibaba.fastjson.JSONObject;
import com.app.common.Result;
import com.app.model.ExposureModel;
import com.app.service.ExposureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 曝光台
 * -曝光台：
 * ->点击进入：新闻展示->点击查看详情
 * ->点击搜索框：关键字查询
 */
@Controller
@RestController
@RequestMapping("/user")
public class ExposureController {

    @Autowired
    private ExposureService exposureService;

    //查询全部
    @GetMapping("/all")
    public Result<Object> getAll(int page, int limit, String exposureTitle, Integer type) {
        ExposureModel model = new ExposureModel();
        model.setPage((page - 1) * limit);
        model.setLimit(limit);
        model.setExposureTitle(exposureTitle);
        model.setType(type);
        return Result.success(exposureService.List(model));
    }

    //  /exposure/content   get请求 参数 id
    //查看内容
    @GetMapping("/content")
    public Result<Object> getContentById(int id) {
        ExposureModel contentById = exposureService.getContentById(id);
        return Result.success(contentById);
    }


}
